<!DOCTYPE html>
<html lang="zh" dir="ltr">
<head><script src="/livereload.js?mindelay=10&amp;v=2&amp;port=1313&amp;path=livereload" data-no-instant defer></script>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="了解神马中转API的使用方法，掌握如何配置和调用中转API服务，轻松解决接口调用难题。">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#343a40">
<meta name="color-scheme" content="light dark"><meta property="og:url" content="http://localhost:1313/docs/ailearn/dev/">
  <meta property="og:site_name" content="神马中转API_低价稳定中转API推荐">
  <meta property="og:title" content="基础教程-开发者 · 快速接入">
  <meta property="og:description" content="了解神马中转API的使用方法，掌握如何配置和调用中转API服务，轻松解决接口调用难题。">
  <meta property="og:locale" content="zh">
  <meta property="og:type" content="article">
    <meta property="article:section" content="docs">
    <meta property="article:modified_time" content="2025-09-21T00:12:32+08:00">
    <meta property="article:tag" content="API">
    <meta property="article:tag" content="中转API">
    <meta property="article:tag" content="服务使用">
<title>基础教程-开发者 · 快速接入 | 神马中转API_低价稳定中转API推荐</title>
<link rel="icon" href="/favicon.png" >
<link rel="manifest" href="/manifest.json">
<link rel="canonical" href="http://localhost:1313/docs/ailearn/dev/">
<link rel="stylesheet" href="/book.min.ce1689397c669bcad456856a83f58cfccb0f8b23e5dd2bbff3755c795c7c8e70.css" integrity="sha256-zhaJOXxmm8rUVoVqg/WM/MsPiyPl3Su/83VceVx8jnA=" crossorigin="anonymous">
  <script defer src="/fuse.min.js"></script>
  <script defer src="/zh.search.min.e0e482070ec6d6d785985b436113219157ff4e98f68389abe3e06a9d7752fafd.js" integrity="sha256-4OSCBw7G1teFmFtDYRMhkVf/Tpj2g4mr4&#43;BqnXdS&#43;v0=" crossorigin="anonymous"></script>

  <script defer src="/sw.min.6f6f90fcb8eb1c49ec389838e6b801d0de19430b8e516902f8d75c3c8bd98739.js" integrity="sha256-b2&#43;Q/LjrHEnsOJg45rgB0N4ZQwuOUWkC&#43;NdcPIvZhzk=" crossorigin="anonymous"></script>
<!--
Made with Book Theme
https://github.com/alex-shpak/hugo-book
-->
  
</head>
<body dir="ltr" class="book-kind-page book-type-docs book-layout-">
  <input type="checkbox" class="hidden toggle" id="menu-control" />
  <input type="checkbox" class="hidden toggle" id="toc-control" />
  <main class="container flex">
    
<aside class="book-menu">
  <div class="book-menu-content">
    
  <nav>
<h2 class="book-brand">
  <a class="flex align-center" href="/"><span>神马中转API_低价稳定中转API推荐</span>
  </a>
</h2>


<div class="book-search hidden">
  <input type="text" id="book-search-input" placeholder="搜索" aria-label="搜索" maxlength="64" data-hotkeys="s/" />
  <div class="book-search-spinner hidden"></div>
  <ul id="book-search-results"></ul>
</div>
<script>document.querySelector(".book-search").classList.remove("hidden")</script>















  
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/introduction/" class="">神马中转API一站式AI大模型API中转站 · 低价好用稳定的中转API服务</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-a1a75651f33f50151b1f3e0e2f525ee1" class="toggle"  />
    <label for="section-a1a75651f33f50151b1f3e0e2f525ee1" class="flex">
      <a role="button" class="flex-auto ">基础知识</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/aidocs/base/" class="">基本概念-令牌（Token）</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/aidocs/key/" class="">添加令牌：您的AI通行证指南</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/aidocs/api/" class="">基本概念-API地址（BaseURL）</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/aidocs/group/" class="">基本概念-令牌渠道分组</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/aidocs/pay1/" class="">基本概念-按量付费</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/aidocs/pay2/" class="">基本概念-按次付费</a>
  

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-cd3c7c429af15477d4ff05ea111934a3" class="toggle" checked />
    <label for="section-cd3c7c429af15477d4ff05ea111934a3" class="flex">
      <a role="button" class="flex-auto ">站内基础教程</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/wallet/" class="">基础教程-钱包 · 页面</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/model/" class="">基础教程-支持模型 · 页面</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/chat/" class="">基础教程-聊天 · 页面</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/dev/" class="active">基础教程-开发者 · 快速接入</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/sdk/" class="">高级功能-官方SDK支持</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/notice/" class="">高级功能-通知设置 · 额度预警通知</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/keysafety/" class="">高级功能-API KEY 安全配置</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/errorcode/" class="">常见报错码</a>
  

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-a2f7d319ec4c5bbb43978c97667e6cea" class="toggle"  />
    <label for="section-a2f7d319ec4c5bbb43978c97667e6cea" class="flex">
      <a role="button" class="flex-auto ">Openai请求格式（通用）</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/syfw/" class="">适用范围：♥ 所有模型</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/ptdhfl/" class="">普通文本对话（非流）</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/ptdhls/" class="">普通文本对话（流式输出）</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/gdgshscjson/" class="">固定格式化输出Json</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/embedding/" class="">embedding代码例子</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/wltpjx/" class="">网络图片解析</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/bdtpjx/" class="">本地图片解析</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/functioncall/" class="">函数调用FunctionCall</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/whisper/" class="">whisper使用示例</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/gpttts/" class="">gpt-tts</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/gptwst/" class="">gpt文生图</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/gpttst/" class="">gpt图生图</a>
  

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-0621f15f4cf04829ac2eddaaa730205e" class="toggle"  />
    <label for="section-0621f15f4cf04829ac2eddaaa730205e" class="flex">
      <a role="button" class="flex-auto ">模型接入教程</a>
    </label>
  

          
  <ul>
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <span>常见AI程序配置教程</span>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-5e705709838a94aa211a15f9c6e02e24" class="toggle"  />
    <label for="section-5e705709838a94aa211a15f9c6e02e24" class="flex">
      <a role="button" class="flex-auto ">编程工具类</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/devtools/claudecode/" class="">Claude code 配置方式</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/devtools/pythonopenai/" class="">python openai官方库（使用AutoGPT，langchain等）</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/devtools/codegpt/" class="">VSCode 插件 Code GPT 使用指南</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/devtools/easycode/" class="">JetBrains插件 Easycode ​</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/devtools/langchain/" class="">LangChain​</a>
  

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-1d8817d18f5c961cd85158eff2d9c95e" class="toggle"  />
    <label for="section-1d8817d18f5c961cd85158eff2d9c95e" class="flex">
      <a role="button" class="flex-auto ">对话客户端类</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/cherrystudio/" class="">Cherry Studio</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/chatgptwebmidjourneyproxy/" class="">Chatgpt-web-midjourney-proxy</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/lobechat/" class="">Lobe-Chat</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/utools-chatgpt/" class="">utools-ChatGPT</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/sidebar/" class="">浏览器插件 ChatGPT Sidebar</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/chatbox/" class="">ChatBox(推荐使用)</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/chatnextweb/" class="">Chat Next Web</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/GoAmz/" class="">GoAmz</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/SparkAI/" class="">SparkAI</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/nineai/" class="">NineAI(99AI) </a>
  

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-b333ba0fec99449c08fe8af0c1f5a49b" class="toggle"  />
    <label for="section-b333ba0fec99449c08fe8af0c1f5a49b" class="flex">
      <a role="button" class="flex-auto ">工具类</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/tools/raycast/" class="">Raycast 插件 ChatGPT 使用指南（推荐使用）</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/tools/dify/" class="">Dify</a>
  

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-5852b31e2d938d5dbe93ddd86df36c0f" class="toggle"  />
    <label for="section-5852b31e2d938d5dbe93ddd86df36c0f" class="flex">
      <a role="button" class="flex-auto ">官方SDK类</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/sdk/openaisdk/" class="">OpenAI官方SDK</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/sdk/geminisdk/" class="">Gemini SDK 配置</a>
  

        </li>
      
    
  </ul>

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/errorcode/" class="">常见错误以及解决办法</a>
  

        </li>
      
    
  </ul>










  
<ul>
  
  <li>
    
    <a href="https://whatai.cc"  target="_blank" rel="noopener">
        AI导航
      </a>
  </li>
  
  <li>
    
    <a href="https://api.whatai.cc"  target="_blank" rel="noopener">
        中转API官网
      </a>
  </li>
  
</ul>






</nav>




  <script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script>



  </div>
</aside>
 

    <div class="book-page">
      <header class="book-header">
        
  <div class="flex align-center justify-between">
  <label for="menu-control">
    <img src="/svg/menu.svg" class="book-icon" alt="Menu" />
  </label>

  <h3>基础教程-开发者 · 快速接入</h3>

  <label for="toc-control">
    
    <img src="/svg/toc.svg" class="book-icon" alt="Table of Contents" />
    
  </label>
</div>


  
  <aside class="hidden clearfix">
    
  
<nav id="TableOfContents">
  <ul>
    <li><a href="#基础教程-开发者--快速接入">基础教程-开发者 · 快速接入</a>
      <ul>
        <li>
          <ul>
            <li><a href="#基础信息"><strong>基础信息</strong></a></li>
            <li><a href="#文本对话接口"><strong>文本对话接口</strong></a></li>
            <li><a href="#请求参数"><strong>请求参数</strong></a></li>
            <li><a href="#curl-示例"><strong>cURL 示例</strong></a></li>
            <li><a href="#python-示例"><strong>Python 示例</strong></a></li>
            <li><a href="#响应"><strong>响应</strong></a></li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>
</nav>



  </aside>
  
 
      </header>

      
      
  <article class="markdown book-article"><h1 id="基础教程-开发者--快速接入">
  基础教程-开发者 · 快速接入
  
  <a class="anchor" href="#%e5%9f%ba%e7%a1%80%e6%95%99%e7%a8%8b-%e5%bc%80%e5%8f%91%e8%80%85--%e5%bf%ab%e9%80%9f%e6%8e%a5%e5%85%a5">#</a>
  
</h1>
<h3 id="基础信息">
  <strong>基础信息</strong>
  
  <a class="anchor" href="#%e5%9f%ba%e7%a1%80%e4%bf%a1%e6%81%af">#</a>
  
</h3>
<ul>
<li>
<p>Base URL: <a href="https://api.whatai.cc">https://api.whatai.cc</a></p>
</li>
<li>
<p>认证方式: Bearer Token (API Key)</p>
</li>
</ul>
<p><strong>更多baseURL👉： 基础概念-API地址（BaseUrl）</strong></p>
<h3 id="文本对话接口">
  <strong>文本对话接口</strong>
  
  <a class="anchor" href="#%e6%96%87%e6%9c%ac%e5%af%b9%e8%af%9d%e6%8e%a5%e5%8f%a3">#</a>
  
</h3>
<p><strong>请求</strong></p>
<ul>
<li>
<p>方法: POST</p>
</li>
<li>
<p>路径: <code>/v1/chat/completions</code></p>
</li>
<li>
<p>Headers:</p>
<ul>
<li>
<p><code>Accept</code>: application/json</p>
</li>
<li>
<p><code>Authorization</code>: Bearer sk-****** (你的API Key)</p>
</li>
<li>
<p><code>User-Agent</code>: DMXAPI/1.0.0 (<a href="https://api.whatai.cc">https://api.whatai.cc</a>)</p>
</li>
<li>
<p><code>Content-Type</code>: application/json</p>
</li>
</ul>
</li>
</ul>
<h3 id="请求参数">
  <strong>请求参数</strong>
  
  <a class="anchor" href="#%e8%af%b7%e6%b1%82%e5%8f%82%e6%95%b0">#</a>
  
</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;model&#34;</span>: <span style="color:#e6db74">&#34;gpt-4o-mini&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;messages&#34;</span>: [
</span></span><span style="display:flex;"><span>    {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;role&#34;</span>: <span style="color:#e6db74">&#34;system&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;content&#34;</span>: <span style="color:#e6db74">&#34;You are a helpful assistant.&#34;</span>
</span></span><span style="display:flex;"><span>    },
</span></span><span style="display:flex;"><span>    {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;role&#34;</span>: <span style="color:#e6db74">&#34;user&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;content&#34;</span>: <span style="color:#e6db74">&#34;周树人和鲁迅是兄弟吗？&#34;</span>
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>  ]
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><h3 id="curl-示例">
  <strong>cURL 示例</strong>
  
  <a class="anchor" href="#curl-%e7%a4%ba%e4%be%8b">#</a>
  
</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>curl -X POST <span style="color:#e6db74">&#34;https://api.whatai.cc/v1/chat/completions&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  -H <span style="color:#e6db74">&#34;Accept: application/json&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  -H <span style="color:#e6db74">&#34;Authorization: Bearer sk-******&#34;</span> <span style="color:#ae81ff">\ </span> <span style="color:#75715e"># 替换为你的API Key</span>
</span></span><span style="display:flex;"><span>  -H <span style="color:#e6db74">&#34;User-Agent: DMXAPI/1.0.0&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  -H <span style="color:#e6db74">&#34;Content-Type: application/json&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  -d <span style="color:#e6db74">&#39;{
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    &#34;model&#34;: &#34;gpt-4o-mini&#34;,
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    &#34;messages&#34;: [
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      {
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        &#34;role&#34;: &#34;system&#34;,
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        &#34;content&#34;: &#34;You are a helpful assistant.&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      },
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      {
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        &#34;role&#34;: &#34;user&#34;,
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        &#34;content&#34;: &#34;周树人和鲁迅是兄弟吗？&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      }
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    ]
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  }&#39;</span>
</span></span></code></pre></div><h3 id="python-示例">
  <strong>Python 示例</strong>
  
  <a class="anchor" href="#python-%e7%a4%ba%e4%be%8b">#</a>
  
</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">import</span> requests
</span></span><span style="display:flex;"><span><span style="color:#f92672">import</span> json
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># API配置</span>
</span></span><span style="display:flex;"><span>url <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;https://api.whatai.cc/v1/chat/completions&#34;</span>
</span></span><span style="display:flex;"><span>headers <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#39;Accept&#39;</span>: <span style="color:#e6db74">&#39;application/json&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#39;Authorization&#39;</span>: <span style="color:#e6db74">&#39;Bearer sk-******&#39;</span>,  <span style="color:#75715e"># 替换为你的API Key</span>
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#39;User-Agent&#39;</span>: <span style="color:#e6db74">&#39;DMXAPI/1.0.0&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#39;Content-Type&#39;</span>: <span style="color:#e6db74">&#39;application/json&#39;</span>
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 请求数据</span>
</span></span><span style="display:flex;"><span>payload <span style="color:#f92672">=</span> json<span style="color:#f92672">.</span>dumps({
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;model&#34;</span>: <span style="color:#e6db74">&#34;gpt-4o-mini&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;messages&#34;</span>: [
</span></span><span style="display:flex;"><span>        {
</span></span><span style="display:flex;"><span>            <span style="color:#e6db74">&#34;role&#34;</span>: <span style="color:#e6db74">&#34;system&#34;</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#e6db74">&#34;content&#34;</span>: <span style="color:#e6db74">&#34;You are a helpful assistant.&#34;</span>
</span></span><span style="display:flex;"><span>        },
</span></span><span style="display:flex;"><span>        {
</span></span><span style="display:flex;"><span>            <span style="color:#e6db74">&#34;role&#34;</span>: <span style="color:#e6db74">&#34;user&#34;</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#e6db74">&#34;content&#34;</span>: <span style="color:#e6db74">&#34;周树人和鲁迅是兄弟吗？&#34;</span>
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>    ]
</span></span><span style="display:flex;"><span>})
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 发送请求</span>
</span></span><span style="display:flex;"><span>response <span style="color:#f92672">=</span> requests<span style="color:#f92672">.</span>post(url, headers<span style="color:#f92672">=</span>headers, data<span style="color:#f92672">=</span>payload)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 输出响应</span>
</span></span><span style="display:flex;"><span>print(response<span style="color:#f92672">.</span>text)
</span></span></code></pre></div><h3 id="响应">
  <strong>响应</strong>
  
  <a class="anchor" href="#%e5%93%8d%e5%ba%94">#</a>
  
</h3>
<p>返回JSON格式的对话结果</p>
<p>提示：将示例中的<code>sk-******</code>替换为你实际的API Key即可使用</p>
</article>
 
      

      <footer class="book-footer">
        
  <div class="flex flex-wrap justify-between">





</div>





  
  
  
  <div class="flex flex-wrap justify-between">
    <span>
    
      <a href="/docs/ailearn/chat/" class="flex align-center book-icon">
        <img src="/svg/backward.svg" class="book-icon" alt="Previous" title="基础教程-聊天 · 页面" />
        <span>基础教程-聊天 · 页面</span>
      </a>
    
    </span>
    <span>
    
      <a href="/docs/ailearn/sdk/" class="flex align-center book-icon">
        <span>高级功能-官方SDK支持</span>
        <img src="/svg/forward.svg" class="book-icon" alt="Next" title="高级功能-官方SDK支持" />
      </a>
    
    </span>
  </div>
  




  <script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script>


 
        
      </footer>

      
  
  <div class="book-comments">

</div>
  
 
      <label for="menu-control" class="hidden book-menu-overlay"></label>
    </div>

    

<aside class="book-toc">
  <div class="book-toc-content">
    
  
<nav id="TableOfContents">
  <ul>
    <li><a href="#基础教程-开发者--快速接入">基础教程-开发者 · 快速接入</a>
      <ul>
        <li>
          <ul>
            <li><a href="#基础信息"><strong>基础信息</strong></a></li>
            <li><a href="#文本对话接口"><strong>文本对话接口</strong></a></li>
            <li><a href="#请求参数"><strong>请求参数</strong></a></li>
            <li><a href="#curl-示例"><strong>cURL 示例</strong></a></li>
            <li><a href="#python-示例"><strong>Python 示例</strong></a></li>
            <li><a href="#响应"><strong>响应</strong></a></li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>
</nav>



  </div>
</aside>

 
  </main>

  
</body>
</html>
















